//
//  MineHeaderView.m
//  EasyToTesco
//
//  Created by mc on 16/2/1.
//  Copyright © 2016年 Jack. All rights reserved.
//

#import "MineHeaderView.h"

#define IMAGEWEITH 60
#define NAMEHEIGHT 20
#define SEXHEIGHT 16
#define MINEMARC 5

@implementation MineHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor colorWithRed:52/255. green:147/255. blue:225/255. alpha:1];
        [self adMineHeaderViewUI];
        // UIImageView *MinePicImage;
       //  UILabel *nameLabel;
        // UILabel *sexLabel;
    }
    return self;
}

- (void)adMineHeaderViewUI {
    CGFloat weith = self.bounds.size.width;
    CGFloat heigh = (self.bounds.size.height - IMAGEWEITH-NAMEHEIGHT-SEXHEIGHT-MINEMARC*2)/2;
    self.MinePicImage = [[UIImageView alloc] initWithFrame:CGRectMake(weith/2 - IMAGEWEITH/2, heigh, IMAGEWEITH, IMAGEWEITH)];
    self.MinePicImage.layer.cornerRadius = IMAGEWEITH/2;
    self.MinePicImage.layer.masksToBounds = YES;
    [self addSubview:self.MinePicImage];
    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.MinePicImage.frame)+MINEMARC, weith, NAMEHEIGHT)];
    self.nameLabel.textAlignment = NSTextAlignmentCenter;
    self.nameLabel.font = [UIFont systemFontOfSize:16];
    self.nameLabel.textColor = [UIColor whiteColor];
    [self addSubview:self.nameLabel];
    
    self.sexLabel = [[UILabel alloc] initWithFrame:CGRectMake(weith/2-SEXHEIGHT*2, CGRectGetMaxY(self.nameLabel.frame)+MINEMARC, SEXHEIGHT*4, SEXHEIGHT)];
    self.sexLabel.textAlignment = NSTextAlignmentCenter;
    self.sexLabel.font = [UIFont systemFontOfSize:12];
    self.sexLabel.layer.cornerRadius = SEXHEIGHT/2;
    self.sexLabel.layer.masksToBounds = YES;
    self.sexLabel.layer.borderWidth = 1;
    self.sexLabel.layer.borderColor = [UIColor whiteColor].CGColor;
    self.sexLabel.textColor = [UIColor whiteColor];
    [self addSubview:self.sexLabel];
    
    
}

@end
